<div id="content">

	<h1>Course Materials</h1>

	<div style="margin:0 50px 0 100px;">
		<h3>Click the links to download:</h3>
		
		<ul>
			<% for file in @listing %>
				<li>
					<span style="font-size: 16px;"><%= link_to file.title, { :controller => "materials", :action => "course_material", :id => file.id} %></span>
					<i> -- <%= h(file.created_at) %></i>
				</li>
			<% end %>
		</ul>
	</div>

	<% if(session[:loginrole] == "Admin") %>
		<% form_for :course_material, :url => {:controller=>"materials", :action => "add_material"}, :html => { :multipart => true } do |form| -%>
			<div style="border: dashed 1px #CCC; padding:3px 15px;">
			<h3>Add Course Materials</h3>
			
				        <table>
				        <tr>
				        <td align="right">Title:</td><td><%= form.text_field("title") %></td>
				        </tr>
					    <tr>
					    <td align="right">File:</td> <td><%= form.file_field("uploaded_document") %></td>
					    </tr>
					    </table>
					    <center><%= submit_tag("Upload file" ) %></center>
			</div>
		<% end %>
	<% end %>	
	
</div>